<?php

namespace App\Criteria\Teacher\Teacher;

use Illuminate\Support\Facades\Input;
use Prettus\Repository\Contracts\CriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;

class CompositionBaseQueryCriteria implements CriteriaInterface{

    public function apply($model, RepositoryInterface $repository){
        $teacher_id=Input::get('teacher_id');
        if($teacher_id){
            $model=$model->where('teacher_id','=',$teacher_id);
        }
        $model=$model->orderBy('acquire_date','desc');
        return $model;
    }
}
